import GlobalEvent from "../Global/GlobalEvent";

//全局英雄金币管理器
class goldManager {
    private static instance: goldManager;
    private gold: number = 50;

    private constructor() { }

    public static getInstance(): goldManager {
        if (!goldManager.instance) {
            goldManager.instance = new goldManager();
        }
        return goldManager.instance;
    }

    //金币因怪物的死亡而增加
    public killMonsterAddGold(monsterGold): void {
        this.gold += monsterGold;
        // console.log('===',this.gold);
    }

    //购买造成金币的减少
    public btnMinuGold(btnGold) {
        this.gold -= btnGold;
        if (this.gold <= 0) {
            return this.gold = 0;
        }
    }

    public getGold() {
        // console.log('===获取现有金币',this.gold);
        
        return this.gold;
    }


}
export default goldManager;